<?php

namespace plugin\exportcenter\app\admin\controller;

use app\common\controller\BaseAdminController;
use plugin\exportcenter\app\logic\ExportLogic;

class ExportCenterController extends BaseAdminController
{
    protected function init()
    {
        parent::init();
        $this->logic = new ExportLogic();
    }

    protected function listOrder()
    {
        return ['id' => "desc"];
    }

    protected function searchWhere()
    {
        $where = [
            ['created_id', '=', request()->uid]
        ];
        $this->form['name'] && $where[] = ['name', 'like', "%{$this->form['name']}%"];
        return $where;
    }

    public function addDownloadNum()
    {
        $this->logic->getModel()->where("id", input("id"))->setInc('download_num', 1);
        return $this->success();
    }
}
